package com.webex.ta.hydra.core.action;

import com.webex.ta.hydra.core.AbstractAction;
import com.webex.ta.hydra.core.ParamDescriptor;
import com.webex.ta.hydra.core.TestResult;
import com.webex.ta.hydra.core.Command;
import com.webex.ta.hydra.core.engine.HydraContextService;

/**
 * Created by IntelliJ IDEA.
 * User: vegaz
 * Date: 2010-8-31
 * Time: 12:34:39
 * To change this template use File | Settings | File Templates.
 */
public class SetVariable extends AbstractAction {
    private static ParamDescriptor[] desc;
    static {
        desc = new ParamDescriptor[2];
        desc[0] = new ParamDescriptor("variable name");
        desc[1] = new ParamDescriptor("variable value");
    }

    public void execute(TestResult result, String... args) {
        HydraContextService.getContext().getVariables().put(params[0].getStringValue(), params[1].getStringValue());
    }

    public ParamDescriptor[] getParamDescriptors(Command cmd) {
        return desc;
    }
}
